<?php
namespace Home\Controller;
use Home\Controller\UserController;
class FinanceController extends UserController {
public function _initialize(){
	parent::_initialize();
	}
	//根据分类获取财务日志
	public function index(){
        $where = [];
        $member_id = $this->uid;
        $type = I('type');
       /*  $currency_id = I('currency_id');
        if($currency_id){
            $where['f.currency_id'] = $currency_id;
        } */
        if(!empty($type)){
            $where['f.currency_id'] = $type;
        }
        $where['member_id'] = $member_id;
        $page = I('page');
        $num = I('num');
        $pages = $this->DoPage($page, $num+10);
        $table = $this->getMemberGroup(intval($member_id));
        $r = M('Finance_'.$table)
        ->alias('f')
        ->join('join yang_currency1 c on f.money_type = c.currency_id')
        ->where($where)
        ->limit($pages['limit'],$pages['num'])
        ->order('add_time desc')
        ->select();
        $count = M('Finance_'.$table)
        ->alias('f')
        ->where($where)
        ->count();
        $data = [
            'status'=>1,
            'data'=>$r,
            'count'=>$count,
        ];
        $this->ajaxReturn($data);
	}
}